//
//  UIView+UUFrame.h
//  OldLayout
//
//  Created by 尤锐 on 16/4/14.
//  Copyright © 2016年 尤锐. All rights reserved.
//
#import <UIKit/UIKit.h>

#define SCREENSIZE [UIScreen mainScreen].bounds.size
#define SCREENWIDTH SCREENSIZE.width
#define SCREENHEIGHT SCREENSIZE.height

#define AutoScaleHorizontal (SCREENHEIGHT>768?SCREENWIDTH/1024.0f:1.0f)
#define AutoScaleVertical (SCREENHEIGHT>768?SCREENHEIGHT/768.0f:1.0f)

CG_INLINE CGRect
UUImageRectMake(CGFloat x,CGFloat y,CGFloat width,CGFloat height){
    CGRect rect;
    rect.origin.x = x * AutoScaleHorizontal;
    rect.origin.y = y * AutoScaleVertical;
    rect.size.width = width * AutoScaleHorizontal;
    rect.size.height = height * AutoScaleVertical;
    return rect;
}

CG_INLINE CGRect
UUHorizontalRectMake(CGFloat x,CGFloat y,CGFloat width,CGFloat height){
    CGRect rect;
    rect.origin.x = x;
    rect.origin.y = y;
    rect.size.width = width * AutoScaleHorizontal;
    rect.size.height = height;
    return rect;
}

CG_INLINE CGRect
UUHRectMake(CGFloat x,CGFloat y,CGFloat width,CGFloat height){
    CGRect rect;
    rect.origin.x = x * AutoScaleHorizontal;
    rect.origin.y = y;
    rect.size.width = width * AutoScaleHorizontal;
    rect.size.height = height;
    return rect;
}

CG_INLINE CGRect
UUSacleRectMake(CGFloat x,CGFloat y,CGFloat width,CGFloat height){
    CGRect rect;
    rect.origin.x = x ;
    rect.origin.y = y;
    rect.size.width = width * AutoScaleHorizontal;
    rect.size.height = height * AutoScaleVertical;
    return rect;
}

@interface UIView (UUFrame)

@property (assign, nonatomic) CGFloat x;
@property (assign, nonatomic) CGFloat y;
@property (assign, nonatomic) CGFloat height;
@property (assign, nonatomic) CGFloat width;
@property (assign, nonatomic) CGPoint origin;
@property (assign, nonatomic) CGSize size;

@end
